StupidBeauty
Read times:469Posted at:Thu Dec 13 04:47:09 2012
- no title specified

转载Embedding Bitmap Images in ActionScript 3 with FlashDevelop

在flashDevelop中,可使用embed指令来向ActionScript3中嵌入图片资源。

http://www.streamhead.com/embedding-images/

亮点

Embedding an image

Now it’s time to get to the gist of the tutorial, actually embedding the image. If you look at your project structure, you’ll also see that FlashDevelop has created a “lib” folder, this is where we’re going to put the images we use in the program.

First, find an image somewhere on the Internet and put it in that lib folder. If it shows up on the project view in FlashDevelop, you did it correctly.

The final step before we can use the image is to add it to the library: right click on the image in the project view and choose “Add to library”. If everything goes well, it will now display in blue instead of black.

With the Main.as file open:

  • •.Put the cursor somewhere just above the “function Main()” declaration

  • •.Right click on the image you want to embed and choose “Insert Into Document”

  • •.An “Embed” code should have appeared.

  • •.Just underneath this new line, add the variable declaration for this image.

private var layer0Class : Class;

  • •.On the next line, instantiate the class, so that we can use it:

private var layer0:Bitmap = new layer0Class();

  • •.If you type this, you will see a FlashDevelop popup when you start typing Bitmap. As soon as you see this, you can select the class you need, which is “flash.display.Bitmap”. This will also import that class.

  • •.If that didn’t happen, you will need to manually add the import. Right at the top of the file, where there are two import statements, add:

import flash.display.Bitmap;

Displaying the bitmap

Now comes the easiest part:

  • •.Find the function where it says “// entry point” (feel free to remove this line as it is not functional)

  • •.Just underneath that line add

addChild(layer0);

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4